<%@ page contentType="text/html;charset=UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>Title</title>
</head>
<body>
<article class="page-container">
    <form action="" method="get" class="form form-horizontal" id="form-admin-add" style="padding-top: 10px">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">编号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" style="background:#F5F5F5" class="input-text" readonly="readonly" id="VALUE01"/>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">生产计划/已完成：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" id="VALUE02">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">

    $(document).ajaxComplete(function (event, xhr) {
        //从http头信息取出 在filter定义的sessionstatus，判断是否是 timeout
        if (xhr.getResponseHeader("sessionstatus") === "timeout") {
            //从http头信息取出登录的url ＝ loginPath
            if (xhr.getResponseHeader("loginPath")) {
                window.location.replace(xhr.getResponseHeader("loginPath"));
            }
        }
    });

    let is_cmd = '<%=request.getParameter("DO")%>';
    let is_id  = '<%=request.getParameter("VALUE01")%>';
    let is_val = '<%=request.getParameter("VALUE02")%>';

    $(document).ready(function () {
        $("#VALUE01").val(is_id);

        f_init1();
    });

    function f_init1()
    {
        $.ajax({                            //该方法提交，在前端获取控件的值去进行提交， 两种方法就是前段和后端的区别
            type: 'post',
            url: "com",
            data: {
                URL: '',
                CMD: 'AQ',
                VALUE01: is_id
            },
            async: false,
            success: function (data) {
                let jsonobj = JSON.parse(data);
                $("#VALUE02").val(jsonobj.db1[0].VALUE16.toString());
            },
            error: function () {
                layer.msg('网络异常错误', {icon: 1, time: 1000});
            }
        });
    }

    $(function () {
        $("#form-admin-add").validate({
            onkeyup: false,
            focusCleanup: true,
            success: "valid",
            submitHandler: function (form) {
                let LS_VALUE01 = $("#VALUE01").val();
                let LS_VALUE02 = $("#VALUE02").val();
                let ls_opid = "${sessionOpid}";
                if (!ls_opid) {
                    layer.msg("请重新登录系统！", {icon: 0, time: 1000});
                    return;
                }

                if (LS_VALUE02.length === 0) {
                    layer.msg("请输入生产计划/已完成", {icon: 2, time: 1500});
                    return;
                }

                layer.confirm('确认要继续操作吗？', {icon: 3}, function () {
                    $.ajax({                            //该方法提交，在前端获取控件的值去进行提交， 两种方法就是前段和后端的区别
                        type: 'post',
                        url: "com",
                        data: {
                            URL: '',
                            CMD: 'AK',
                            VALUE01: LS_VALUE01,
                            VALUE02: "SCJHYWC",
                            VALUE03: LS_VALUE02
                        },
                        async: false,
                        success: function (data) {
                            let jsonobj = JSON.parse(data);
                            let json1 = jsonobj.db1;
                            if (json1[0].VALUE01.toString() === 'ZZ00') {
                                layer.msg('数据库操作完毕!', {icon: 1, time: 1000}, function () {
                                    var index = parent.layer.getFrameIndex(window.name);
                                    parent.f_getinfo();
                                    parent.layer.close(index);
                                });
                            } else {
                                layer.msg(json1[0].VALUE02.toString(), {icon: 2, time: 2000, area: ['auto', '65px']}, function () {
                                    let index = parent.layer.getFrameIndex(window.name);
                                    parent.layer.close(index);
                                });
                            }
                        },
                        error: function () {
                            layer.msg('网络异常错误', {icon: 1, time: 1000});
                        }
                    });
                })
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
